package cn.bonoon.kernel.support;

import cn.bonoon.core.ILoginEditor;
import cn.bonoon.kernel.exceptions.PasswordVerifierException;
import cn.bonoon.kernel.support.entities.EntityLoginable;

/**
 * 专门用来验证密码的算法
 * @author jackson
 *
 */
public interface PasswordVerifier {
	void set(EntityLoginable entity, ILoginEditor editor) throws PasswordVerifierException;
	
	void setPassword(EntityLoginable entity, String pwd, String repwd) throws PasswordVerifierException;
	void resetPassword(EntityLoginable entity, String oldPwd, String pwd, String repwd)throws PasswordVerifierException;
	String verify(String pwd, String repwd)throws PasswordVerifierException;
	String randomPassword(EntityLoginable entity)throws PasswordVerifierException;
	
	void setLoginName(EntityLoginable entity, String loginName) throws PasswordVerifierException;
	String verify(String loginName) throws PasswordVerifierException;
	String encodePassword(String pwd) throws PasswordVerifierException;
}
